package com.fr.demo.service;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;

@Service
public class CustomUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        // 实现根据用户名加载用户详情的逻辑
        // 这里只是一个简单的示例，实际应用中需要查询数据库等
        return User.withDefaultPasswordEncoder()
                .username(username)
                .password("123456")
                .roles("USER")
                .build();
    }
}